home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
cuj1008.zip
/
1008014A
< prev
next >
Wrap
Text File
|
1992-06-12
|
489b
|
29 lines
Listing 3 -- exit.c
/* exit function */
#include <stdio.h>
#include <stdlib.h>
#include "yfuns.h"
/* macros */
#define NATS 32
/* static data */
void (*_Atfuns[NATS])(void) = {0};
size_t _Atcount = {NATS};
void (exit)(int status)
{ /* tidy up and exit to system */
while (_Atcount < NATS)
(*_Atfuns[_Atcount++])();
{ /* close all files */
size_t i;
for (i = 0; i < FOPEN_MAX; ++i)
if (_Files[i])
fclose(_Files[i]);
}
_Exit(status);
}